package com.whcoding.designpatterns.pattern.factorypattern.easyfactory;

import com.whcoding.designpatterns.pattern.factorypattern.easyfactory.service.ICar;

/**
 * @program: spring-boot-learning
 * @description:
 * @author: whcoding
 * @create: 2022-09-19 16:40
 **/
public class ConsumerTests {

	/**
	 * 操作步骤
	 *
	 * 1.添加ICar接口、里面方法为carBrandName
	 *
	 * 2.添加ICar 接口的实现类，AudiCarImpl、BydCarImpl、TeslaCarImpl
	 *
	 * 3.添加CarFactory
	 *
	 * 4.根据不同的类型、生成不同的实现类
	 *
	 * @param args
	 */
	public static void main(String[] args) {
		ICar audi = CarFactory.getCar("奥迪");
		ICar tesla = CarFactory.getCar("特斯拉");

		audi.carBrandName();  //输出：汽车品牌为奥迪
		tesla.carBrandName();   //输出：汽车品牌为特斯拉
	}
}
